Skip to main content

TRREST_CNREST

Trigger REST and Connector REST samples

Sr. NoService NameDescriptionDetails
1.getMultipleRecordGet Multiple record from India Post API https://api.postalpincode.in . No Query or Path parameter passed and pincode is passed in the basepath itself. The output of the rest connector is used as the trigger response and returned as is.
2.getRecordPathParamGet Single record from India Post API. Get PostCode from DB for an custoemr id. Pass the post code as REST Path parameter. The output of the rest connector is used as the trigger resoponse and returned as is.
3.getRecordQueryparamGet Single record from SFDC API using query param.
4.dynamicHeaderGet Single record from India Post API. Pass the post code from query params as REST Path parameter. set header dynamically through request params.
5.staticHeaderGet Single record from India Post API https://api.postalpincode.in . No Query or Path parameter passed and pincode is passed in the basepath itself. set static value to header, Content-Type is set as application/json as is static.
6.requestHeaderDynamic Rest is called, with all parameters passed dynamically from query params. since no request header is passed explicitly, the headers will be passed as is from the call request to this trigger.
7.globalvariableHeaderValues to the rest connector like headers and path/query parameter are passed from Global Variables with the key "VARIABLES". eg. "$VARIABLES.query"
8.dynamicQueryParamSet query parameter dynamically through variable the value of q ie Services can be taken from request/query parameters.
9.staticQueryParamSet static value to query param . the values like headers and query params for the rest api are set in with static hardcoded values.
10.requestParampass the same request query param as is.
11.globalQueryParamget the query param value from global variable set the limit global variable as 10 an dpass in rest.
12.dynamicPathParamGet Singel record from India Post API, Get PostCode from DB for an custoemr id . Pass the post code as REST Path parameter. The output of the rest connector is used as the trigger resoponse and returned as is.
13.staticPathParamset static value to path param. For the rest connector, whenc calling the postal pincode, the path param is configured and the values is set static, i.e hardcoded. This values is passed to the api at the time of calling.
14.requestPathParampass the same request path param as is. For the rest connector, whenc calling the postal pincode, the path param is configured and the values is set taking the value from path parameters of the main request. This values is passed to the api at the time of calling.
15.globalVariablePathParamget the path param value from global variable. For the rest connector, whenc calling the postal pincode, the path param is configured and the values is set taking the value from Global Variables, .e.g. $VARIABLES.pin This values is passed to the api at the time of calling.
16.postStaticREST POST method - use this URL to post record - https://reqres.in/
17.postDynamicREST POST method - use this URL to post record - https://reqres.in/
{
"name": "John Smith 485",
"job": "Manager 970"
}
18.putDataREST PUT method - use this URL to post record - https://reqres.in/
{
"name": "John Smith 109",
"job": "Manager 357"
}
19.deleteDataREST DELETE method - use this URL to post record - https://reqres.in/
20.patchDataREST PATCH method - use this URL to post record - http://localhost:8083 and if rest step throws exception rethrow same with same code and description.
{
"city": "Mumbai",
"phone": "9876345560",
"refid": "",
"state": "Maharastra",
"country": "India",
"postalCode": "110001",
"creditLimit": "445623.11",
"addressLine1": "",
"addressLine2": "",
"customerName": "John Watson",
"contactLastName": "John",
"contactFirstName": "Watson",
"salesRepEmployeeNumber": "1702"
}
21.postDataWithTemplateREST POST method, post body using file/template rather that sattic body - use this URL to post record - https://reqres.in/
{
"name": "John",
"job": "Manager"
}
22.dynamicGetuse India postal code service - https://api.postalpincode.in/pincode/110001 -- invokeDynamicRest without security
23.dynamicPostuse OKTA rest service to create a customer -- invokeDynamicRest with APIKEY security
{
"method": "POST",
"protocol": "https",
"domain": "dev-55000538.okta.com",
"basepath": "/api/v1/users?activate=false",
"input": {
"profile": {
"firstName": "John_587",
"lastName": "Smith_473",
"email": "John_Smith_46@gmail.com",
"login": "John_Smith_46@gmail.com"
}
}
}
24.dynamicPutuse OKTA rest service to create a customer -- invokeDynamicRest with APIKEY security
{
"method": "PUT",
"protocol": "https",
"domain": "dev-55000538.okta.com",
"basepath": "/api/v1/users/00udpvceehb4vYQPx5d7",
"input": {
"profile": {
"firstName": "Shyam",
"lastName": "Gupta",
"email": "shyamgupta11@gmail.com",
"login": "shyamgupta11@gmail.com",
"mobilePhone": "555-415-1337",
"city": "Florida",
"state": "USA"
}
}
}
25.dynamicDeleteuse OKTA rest service to create a customer -- invokeDynamicRest with APIKEY security
26.postDataValidationinput hedaer key Content-Type -> applcaitoninput/json while calling the REST and Rest Response json
{
"consent": "Y",
"pan": "BQHPJ7128J"
}
27.jsonResponseCallException Handling Response in case of - Invalid URL
28.invalidUrlException Handling Response in case of - Invalid URL
{
"method": "GET",
"protocol": "https",
"domain": "api.postalpincode.inkl",
"basepath": "/pincode/431001"
}
29.noPathParamException Handling Response in case of - Path Parameter not sent
{
"method": "GET",
"protocol": "https",
"domain": "reqres.in",
"basepath": "/api/users/p"
}
30.noQueryParamException Handling Response in case of - URL Parameter not set
{
"method": "GET",
"protocol": "https",
"domain": "reqres.in",
"basepath": "/api/users/p"
}
31.invalidSecurityException Handling Response in case of - Wrong or expired security
{
"method": "GET",
"protocol": "https",
"domain": "api.postalpincode.inkl",
"basepath": "/pincode/431001"
}
32.deleteOverrideResponseCodeDelete the contact record which returns 204 as status code. Pass this staus code to caller
33.restExceptionHandlingThis case involves handling of error data if there is any error while executing the rest step. In this example, we are calling a postal api, which needds pincode. We are not passing this pincode, which will give an error. This error will be stored in "ERROR" object in the pipeline. Then we have step exception block where we have a step whcih will throw business exception, with message and code
34.restWithTimeoutsetting timeout. if connection take longer that set time, gives timeout error.
35.restWithoutTimeoutsetting timeout. will not give error since not timeout occurs